{{- $self := .self -}}
{{- .page_scratch.Add "js" (dict "file" "syna-react.js") -}}
{{- .page_scratch.Set "react" true -}}
{{- $bg := .self.Scratch.Get "bg" }}

{{- partial "helpers/container.html" (dict "start" true "in_slot" .in_slot "bg" $bg "id" .id "Params" .Params) -}}
  <div data-portal></div>
{{- partial "helpers/container.html" (dict "end" true "in_slot" .in_slot) -}}
{{- if .page.File.Dir -}}
  <script>
    (window.editors || (window.editors = [])).push({
      ui: JSON.parse({{ readFile (printf "%s%s/ui.json" .page.File.Dir .Name) | safeHTML }}),
      schema: JSON.parse({{ readFile (printf "%s%s/schema.json" .page.File.Dir .Name) | safeHTML }}),
      container: {{ printf "#%s [data-portal]" .Name }}
    });
  </script>
{{- end -}}
